package NenuTest;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;


/**
 * Created with IntelliJ IDEA.
 * User: stem
 * Date: 24.11.13
 * Time: 17:22
 * To change this template use File | Settings | File Templates.
 */
public class WebDriverFactory {

        /* Browsers constants */
        public static final String CHROME = "chrome";
        public static final String FIREFOX = "firefox";


        public WebDriver initDriver (String browser)
        {
            WebDriver testDriver = setDefaultConfiguration(browser);
            return testDriver;
        }

        private WebDriver setDefaultConfiguration(String browser)
        {
            WebDriver driver = null;


            if (browser.equals(FIREFOX))
            {
                driver = new FirefoxDriver();
            } else
            if (browser.equals(CHROME))
            {
                System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
                driver = new ChromeDriver();
            }

            return driver;
        }
}